<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="患者编号" prop="patientNumber">
        <el-input
          v-model="queryParams.patientNumber"
          placeholder="请输入患者编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="诊断类别" prop="patientDiagnosisCategory">
        <el-select v-model="queryParams.patientDiagnosisCategory" placeholder="请选择诊断类别" clearable>
          <el-option
            v-for="dict in dict.type.he_diagnosis_category"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="病历号/门诊号" prop="patientRecordOutpatient">
        <el-input
          v-model="queryParams.patientRecordOutpatient"
          placeholder="请输入病历号/门诊号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="姓名" prop="patientName">
        <el-input
          v-model="queryParams.patientName"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="性别" prop="patientGender">
        <el-select v-model="queryParams.patientGender" placeholder="请选择性别" clearable>
          <el-option
            v-for="dict in dict.type.he_patient_gender"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="出生日期" prop="patientDateOfBirth">
        <el-date-picker clearable
          v-model="queryParams.patientDateOfBirth"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择出生日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="年龄" prop="patientAge">
        <el-input
          v-model="queryParams.patientAge"
          placeholder="请输入年龄"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="年龄阶段" prop="patientAgeStage">
        <el-select v-model="queryParams.patientAgeStage" placeholder="请选择年龄阶段" clearable>
          <el-option
            v-for="dict in dict.type.he_patient_age_grades"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="民族" prop="patientEthnicGroup">
        <el-select v-model="queryParams.patientEthnicGroup" placeholder="请选择民族" clearable>
          <el-option
            v-for="dict in dict.type.he_patient_ethnic_group"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="体重" prop="patientWeight">
        <el-input
          v-model="queryParams.patientWeight"
          placeholder="请输入体重"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="原患疾病" prop="patientPreExistingDisease">
        <el-input
          v-model="queryParams.patientPreExistingDisease"
          placeholder="请输入原患疾病"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="联系方式" prop="patientContact">
        <el-input
          v-model="queryParams.patientContact"
          placeholder="请输入联系方式"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="家属电话" prop="patientFamilyNumber">
        <el-input
          v-model="queryParams.patientFamilyNumber"
          placeholder="请输入家属电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="就诊时间" prop="patientAdmissionTime">
        <el-date-picker clearable
          v-model="queryParams.patientAdmissionTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择就诊时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="科室" prop="patientDepartment">
        <el-input
          v-model="queryParams.patientDepartment"
          placeholder="请输入科室"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="床号" prop="patientBedNumber">
        <el-input
          v-model="queryParams.patientBedNumber"
          placeholder="请输入床号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="护理级别" prop="patientNursingLevel">
        <el-select v-model="queryParams.patientNursingLevel" placeholder="请选择护理级别" clearable>
          <el-option
            v-for="dict in dict.type.he_patient_nursing_level"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="文化程度" prop="patientEducationLevel">
        <el-select v-model="queryParams.patientEducationLevel" placeholder="请选择文化程度" clearable>
          <el-option
            v-for="dict in dict.type.he_patient_education_level"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="备注1" prop="note1">
        <el-input
          v-model="queryParams.note1"
          placeholder="请输入备注1"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注2" prop="note2">
        <el-input
          v-model="queryParams.note2"
          placeholder="请输入备注2"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注3" prop="note3">
        <el-input
          v-model="queryParams.note3"
          placeholder="请输入备注3"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注4" prop="note4">
        <el-input
          v-model="queryParams.note4"
          placeholder="请输入备注4"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注5" prop="note5">
        <el-input
          v-model="queryParams.note5"
          placeholder="请输入备注5"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注6" prop="note6">
        <el-input
          v-model="queryParams.note6"
          placeholder="请输入备注6"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注7" prop="note7">
        <el-input
          v-model="queryParams.note7"
          placeholder="请输入备注7"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注8" prop="note8">
        <el-input
          v-model="queryParams.note8"
          placeholder="请输入备注8"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注9" prop="note9">
        <el-input
          v-model="queryParams.note9"
          placeholder="请输入备注9"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注10" prop="note10">
        <el-input
          v-model="queryParams.note10"
          placeholder="请输入备注10"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker clearable
          v-model="queryParams.createTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="用户ID" prop="userId">
        <el-input
          v-model="queryParams.userId"
          placeholder="请输入用户ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门ID" prop="deptId">
        <el-input
          v-model="queryParams.deptId"
          placeholder="请输入部门ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['project:patient:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['project:patient:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['project:patient:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['project:patient:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="patientList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="患者编号" align="center" prop="patientNumber" />
      <el-table-column label="诊断类别" align="center" prop="patientDiagnosisCategory">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_diagnosis_category" :value="scope.row.patientDiagnosisCategory"/>
        </template>
      </el-table-column>
      <el-table-column label="病历号/门诊号" align="center" prop="patientRecordOutpatient" />
      <el-table-column label="姓名" align="center" prop="patientName" />
      <el-table-column label="性别" align="center" prop="patientGender">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_patient_gender" :value="scope.row.patientGender"/>
        </template>
      </el-table-column>
      <el-table-column label="出生日期" align="center" prop="patientDateOfBirth" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.patientDateOfBirth, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="年龄" align="center" prop="patientAge" />
      <el-table-column label="年龄阶段" align="center" prop="patientAgeStage">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_patient_age_grades" :value="scope.row.patientAgeStage"/>
        </template>
      </el-table-column>
      <el-table-column label="民族" align="center" prop="patientEthnicGroup">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_patient_ethnic_group" :value="scope.row.patientEthnicGroup"/>
        </template>
      </el-table-column>
      <el-table-column label="体重" align="center" prop="patientWeight" />
      <el-table-column label="原患疾病" align="center" prop="patientPreExistingDisease" />
      <el-table-column label="联系方式" align="center" prop="patientContact" />
      <el-table-column label="家属电话" align="center" prop="patientFamilyNumber" />
      <el-table-column label="就诊时间" align="center" prop="patientAdmissionTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.patientAdmissionTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="科室" align="center" prop="patientDepartment" />
      <el-table-column label="床号" align="center" prop="patientBedNumber" />
      <el-table-column label="护理级别" align="center" prop="patientNursingLevel">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_patient_nursing_level" :value="scope.row.patientNursingLevel"/>
        </template>
      </el-table-column>
      <el-table-column label="文化程度" align="center" prop="patientEducationLevel">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_patient_education_level" :value="scope.row.patientEducationLevel"/>
        </template>
      </el-table-column>
      <el-table-column label="诊断" align="center" prop="patientDiagnosis" />
      <el-table-column label="备注1" align="center" prop="note1" />
      <el-table-column label="备注2" align="center" prop="note2" />
      <el-table-column label="备注3" align="center" prop="note3" />
      <el-table-column label="备注4" align="center" prop="note4" />
      <el-table-column label="备注5" align="center" prop="note5" />
      <el-table-column label="备注6" align="center" prop="note6" />
      <el-table-column label="备注7" align="center" prop="note7" />
      <el-table-column label="备注8" align="center" prop="note8" />
      <el-table-column label="备注9" align="center" prop="note9" />
      <el-table-column label="备注10" align="center" prop="note10" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="用户ID" align="center" prop="userId" />
      <el-table-column label="部门ID" align="center" prop="deptId" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['project:patient:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['project:patient:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改患者信息
对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="患者编号" prop="patientNumber">
          <el-input v-model="form.patientNumber" placeholder="请输入患者编号" />
        </el-form-item>
        <el-form-item label="诊断类别" prop="patientDiagnosisCategory">
          <el-select v-model="form.patientDiagnosisCategory" placeholder="请选择诊断类别">
            <el-option
              v-for="dict in dict.type.he_diagnosis_category"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="病历号/门诊号" prop="patientRecordOutpatient">
          <el-input v-model="form.patientRecordOutpatient" placeholder="请输入病历号/门诊号" />
        </el-form-item>
        <el-form-item label="姓名" prop="patientName">
          <el-input v-model="form.patientName" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="性别" prop="patientGender">
          <el-select v-model="form.patientGender" placeholder="请选择性别">
            <el-option
              v-for="dict in dict.type.he_patient_gender"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="出生日期" prop="patientDateOfBirth">
          <el-date-picker clearable
            v-model="form.patientDateOfBirth"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择出生日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="年龄" prop="patientAge">
          <el-input v-model="form.patientAge" placeholder="请输入年龄" />
        </el-form-item>
        <el-form-item label="年龄阶段" prop="patientAgeStage">
          <el-select v-model="form.patientAgeStage" placeholder="请选择年龄阶段">
            <el-option
              v-for="dict in dict.type.he_patient_age_grades"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="民族" prop="patientEthnicGroup">
          <el-select v-model="form.patientEthnicGroup" placeholder="请选择民族">
            <el-option
              v-for="dict in dict.type.he_patient_ethnic_group"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="体重" prop="patientWeight">
          <el-input v-model="form.patientWeight" placeholder="请输入体重" />
        </el-form-item>
        <el-form-item label="原患疾病" prop="patientPreExistingDisease">
          <el-input v-model="form.patientPreExistingDisease" placeholder="请输入原患疾病" />
        </el-form-item>
        <el-form-item label="联系方式" prop="patientContact">
          <el-input v-model="form.patientContact" placeholder="请输入联系方式" />
        </el-form-item>
        <el-form-item label="家属电话" prop="patientFamilyNumber">
          <el-input v-model="form.patientFamilyNumber" placeholder="请输入家属电话" />
        </el-form-item>
        <el-form-item label="就诊时间" prop="patientAdmissionTime">
          <el-date-picker clearable
            v-model="form.patientAdmissionTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择就诊时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="科室" prop="patientDepartment">
          <el-input v-model="form.patientDepartment" placeholder="请输入科室" />
        </el-form-item>
        <el-form-item label="床号" prop="patientBedNumber">
          <el-input v-model="form.patientBedNumber" placeholder="请输入床号" />
        </el-form-item>
        <el-form-item label="护理级别" prop="patientNursingLevel">
          <el-select v-model="form.patientNursingLevel" placeholder="请选择护理级别">
            <el-option
              v-for="dict in dict.type.he_patient_nursing_level"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="文化程度" prop="patientEducationLevel">
          <el-select v-model="form.patientEducationLevel" placeholder="请选择文化程度">
            <el-option
              v-for="dict in dict.type.he_patient_education_level"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="诊断" prop="patientDiagnosis">
          <el-input v-model="form.patientDiagnosis" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注1" prop="note1">
          <el-input v-model="form.note1" placeholder="请输入备注1" />
        </el-form-item>
        <el-form-item label="备注2" prop="note2">
          <el-input v-model="form.note2" placeholder="请输入备注2" />
        </el-form-item>
        <el-form-item label="备注3" prop="note3">
          <el-input v-model="form.note3" placeholder="请输入备注3" />
        </el-form-item>
        <el-form-item label="备注4" prop="note4">
          <el-input v-model="form.note4" placeholder="请输入备注4" />
        </el-form-item>
        <el-form-item label="备注5" prop="note5">
          <el-input v-model="form.note5" placeholder="请输入备注5" />
        </el-form-item>
        <el-form-item label="备注6" prop="note6">
          <el-input v-model="form.note6" placeholder="请输入备注6" />
        </el-form-item>
        <el-form-item label="备注7" prop="note7">
          <el-input v-model="form.note7" placeholder="请输入备注7" />
        </el-form-item>
        <el-form-item label="备注8" prop="note8">
          <el-input v-model="form.note8" placeholder="请输入备注8" />
        </el-form-item>
        <el-form-item label="备注9" prop="note9">
          <el-input v-model="form.note9" placeholder="请输入备注9" />
        </el-form-item>
        <el-form-item label="备注10" prop="note10">
          <el-input v-model="form.note10" placeholder="请输入备注10" />
        </el-form-item>
        <el-form-item label="用户ID" prop="userId">
          <el-input v-model="form.userId" placeholder="请输入用户ID" />
        </el-form-item>
        <el-form-item label="部门ID" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入部门ID" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listPatient, getPatient, delPatient, addPatient, updatePatient } from "@/api/project/patient";

export default {
  name: "Patient",
  dicts: ['he_patient_age_grades', 'he_patient_education_level', 'he_patient_gender', 'he_diagnosis_category', 'he_patient_nursing_level', 'he_patient_ethnic_group'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 患者信息表格数据
      patientList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        patientNumber: null,
        patientDiagnosisCategory: null,
        patientRecordOutpatient: null,
        patientName: null,
        patientGender: null,
        patientDateOfBirth: null,
        patientAge: null,
        patientAgeStage: null,
        patientEthnicGroup: null,
        patientWeight: null,
        patientPreExistingDisease: null,
        patientContact: null,
        patientFamilyNumber: null,
        patientAdmissionTime: null,
        patientDepartment: null,
        patientBedNumber: null,
        patientNursingLevel: null,
        patientEducationLevel: null,
        patientDiagnosis: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
        createTime: null,
        userId: null,
        deptId: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询患者信息
列表 */
    getList() {
      this.loading = true;
      listPatient(this.queryParams).then(response => {
        this.patientList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        patientNumber: null,
        patientDiagnosisCategory: null,
        patientRecordOutpatient: null,
        patientName: null,
        patientGender: null,
        patientDateOfBirth: null,
        patientAge: null,
        patientAgeStage: null,
        patientEthnicGroup: null,
        patientWeight: null,
        patientPreExistingDisease: null,
        patientContact: null,
        patientFamilyNumber: null,
        patientAdmissionTime: null,
        patientDepartment: null,
        patientBedNumber: null,
        patientNursingLevel: null,
        patientEducationLevel: null,
        patientDiagnosis: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
        createTime: null,
        updateTime: null,
        userId: null,
        deptId: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加患者信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getPatient(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改患者信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePatient(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPatient(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除患者信息编号为"' + ids + '"的数据项？').then(function() {
        return delPatient(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('project/patient/export', {
        ...this.queryParams
      }, `patient_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
